package logic

import (
	"context"
	"doctor-medicine-system/models/mysql"

	"doctor-medicine-system/doctorrpc/doctorrpc"
	"doctor-medicine-system/doctorrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodListLogic {
	return &GoodListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 列表
func (l *GoodListLogic) GoodList(in *doctorrpc.GoodListRequest) (*doctorrpc.GoodListResponse, error) {
	// todo: add your logic here and delete this line

	var goodlist []*doctorrpc.GoodList

	goodlist = mysql.GoodList(mysql.DB, in.DoctorId)

	return &doctorrpc.GoodListResponse{
		List: goodlist,
	}, nil
}
